import { request } from "@/utils/axios"
/**
 * 组委会信息接口
 * 获取组委会基本信息
 */
export function getInformation() {
    return request(
        {
            url: "/information/getInformation",
            method: "GET",
            data: {}
        }
    );
}

/**
 * 保存基本信息
 */
export function saveInformation(data) {
    return request(
        {
            url: `information/saveInformation`,
            method: "POST",
            data
        }
    );
}

/**
 * 获取地区
 */
export function getArea() {
    return request(
        {
            url: `/information/getArea?pid=1`,
            method: "GET",
            data: {}
        }
    );
}

/**
 * 根据pid 获取上层管理者的信息
 */
export function getManager(pid) {
    return request(
        {
            url: `information/getManager?pid=${pid}`,
            method: "GET",
            data: {}
        }
    );
}

/**
 * 获取组委会管理列表
 * 组委会管理
 */
export function getOrganizers(params) {
    return request(
        {
            url: "/organizing/getOrganizers",
            method: "GET",
            data: {},
            params
        }
    );
}

/**
 * 邀请组委会
 */
export function enterAgent(data) {
    return request(
        {
            url: "/organizing/enterAgent",
            method: "POST",
            data
        }
    );
}

/**
 * 编辑组委会
 */
export function updateAgent(data) {
    return request(
        {
            url: "/organizing/updateAgent",
            method: "PUT",
            data
        }
    );
}

/**
 * 删除组委会
 */
export function deleteAgentOrOrganizer(userIds) {
    return request(
        {
            url: `/organizing/deleteAgentOrOrganizer?userIds=${userIds}`,
            method: "DELETE",
            data: {}
        }
    );
}
/**
 * 设置目标人数
 */
export function setAgentTarget(params) {
    return request(
        {
            url: `/organizing/setAgentTarget`,
            method: "PUT",
            data: {},
            params
        }
    );
}

/**
 * 获取机构管理列表
 * 机构管理
 */
export function findOrganizationListPage(params) {
    return request(
        {
            url: `/agent/findOrganizationListPage`,
            method: "GET",
            params: params
        }
    );
}

/**
 * 修改机构信息
 */
export function updateInstitutionInfo(data) {
    return request(
        {
            url: `/agent/updateInstitutionInfo`,
            method: "PUT",
            data
        }
    );
}

/**
 * 根据p_id 查询组委会名称
 */
export function getInformationByUserId(params) {
    return request(
        {
            url: `/information/getInformationByUserId`,
            method: "GET",
            params
        }
    );
}
/**
 * 转移 1.先获取组委会列表
 */
export function getAgents(params = {}) {
    return request(
        {
            url: `/organizing/getAgents`,
            method: "GET",
            params: params
        }
    );
}

/**
 * 转移 2.转移一个机构到其他组委会
 */
export function transfer(params) {
    return request(
        {
            url: `/organizing/transfer`,
            method: "PUT",
            data: {},
            params
        }
    );
}


/**
 * 报名管理
 * 获取所有参赛学手列表 默认分页10条记录
 */
export function getEvents(params) {
    return request(
        {
            url: `/institution/getEvents`,
            method: "GET",
            data: {},
            params
        }
    );
}
/**
 * 新增赛项
 */
export function addEvent(data) {
    return request(
        {
            url: `/organizing/addEvent`,
            method: "POST",
            data
        }
    );
}

/**
 * 更改赛项
 */
export function updateEvent(data) {
    return request(
        {
            url: `/organizing/updateEvent`,
            method: "PUT",
            data,

        }
    );
}
/**
 * 删除赛项
 */
export function deleteEvent(params) {
    return request(
        {
            url: `/institution/deleteEvent`,
            method: "DELETE",
            data: {},
            params
        }
    );
}


/**
 * 查询赛项
 */
export function getEventInfoByEventId(params) {
    return request(
        {
            url: `/institution/getEventInfoByEventId`,
            method: "GET",
            data: {},
            params
        }
    );
}


/**
 * 获赛项分小组
 */
export function getGroups() {
    return request(
        {
            url: `/institution/getGroups`,
            method: "GET",
            data: {}
        }
    );
}


/**
 * 获取人员管理列表 默认分页10条记录
 */
export function getAllStudent(params) {
    return request(
        {
            url: `/organizing/getAllStudent`,
            method: "GET",
            data: {},
            params
        }
    );
}
/**
 * 重置密码
 */
export function resetPassword(userId) {
    return request(
        {
            url: `/organizing/resetPassword?userId=${userId}`,
            method: "PUT",
            data: {}
        }
    );
}

/**
 * 分组管理
 * 分组列表查询
 */
export function getGroupListPage(params) {
    return request(
        {
            url: `/group/getGroupListPage`,
            method: "GET",
            data: {},
            params
        }
    );
}
/**
 * 添加分组数据
 */
export function saveGroup(data) {
    return request(
        {
            url: `/group/saveGroup`,
            method: "POST",
            data
        }
    );
}
/**
 * 修改分组数据
 */
export function updateGroup(data) {
    return request(
        {
            url: `/group/updateGroup`,
            method: "PUT",
            data
        }
    );
}
/**
 * 删除分组数据
 */
export function deleteGroup(groupId) {
    return request(
        {
            url: `/group/deleteGroup/${groupId}`,
            method: "DELETE",
            data: {},

        }
    );
}
